'use strict';
var express = require('express');
var router = express.Router();
var request = require('request');
var async = require('async');
var logger = require('../logger');
var superagent = require('superagent');
var jwt = require('jsonwebtoken');
var mongo = require('mongoskin');
var http = require("http");
var redis = require("redis");
var client = redis.createClient(6379,"127.0.0.1");


var db = mongo.db("mongodb://localhost:27017/morningSign");
db.bind('morningSign');


/**
 * 早起签到
 * @param {*} req 
 * @param {*} res 
 * @param {*} next 
 */
function morningSign (req, res, next)
{
    var token = req.body.token;
    //TODO get course data
    var time = req.body.time;
    if(token){
        try{
            let decoded = jwt.verify(token, 'thefirstminappofvtmer');
            
        }catch(err){
            res.send({ code: 401, message: 'token invid' + err });
        }
    }else {
        res.send({ code:402, message:'required token' });
    }
}



module.exports = {morningSign };
